package java8.future;

import java.util.Random;
import java.util.concurrent.CompletableFuture;

/**
 * @program: util
 * @description:
 * @author: zhouliangliang
 * @create: 2019-09-16 11:33
 **/
public class CompletableFutureTest {

    public Double test() {
        try {
            CompletableFuture<Double> future = CompletableFuture.supplyAsync(()-> new Random().nextDouble());
            return future.get();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) {
        System.out.println(new CompletableFutureTest().test());
    }
}
